import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";

var _class, _temp;

import React, { Component } from "react";
import intl from "cpaas-front/lib/utils/intl";
import { BlockContainer } from "./index.style";
import SectionTitle from "../_components/SectionTitle";
import ConfigItem from "../_components/ConfigItem";
import withFormOperate from "../_components/withFormOperate";
import MotionTitle from "../_components/MotionTitle";
import { getMemoizedAssets, getStaticGif } from "./util";

var SelectConfig = withFormOperate(_class = (_temp = /*#__PURE__*/function (_Component) {
  _inherits(SelectConfig, _Component);

  function SelectConfig() {
    var _getPrototypeOf2;

    var _this;

    _classCallCheck(this, SelectConfig);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SelectConfig)).call.apply(_getPrototypeOf2, [this].concat(args)));
    _this.memoizedBaseSelect = getMemoizedAssets(_this.props.styleCounts.select, "select/selection");
    _this.memoizedLabelSelect = getMemoizedAssets(_this.props.styleCounts.select, "select/label-selection");
    _this.memoizedIconSelect = getMemoizedAssets(_this.props.styleCounts.select, "select/icon-selection");
    _this.memoizedDateSelect = getMemoizedAssets(_this.props.styleCounts.select, "select/date-selection");
    _this.memoizedDateTimeSelect = getMemoizedAssets(_this.props.styleCounts.select, "select/date+time-selection");
    _this.memoizedRangeSelect = getMemoizedAssets(_this.props.styleCounts.select, "select/scope-date-selection");
    _this.getMotions = getStaticGif(2, "select/motions");
    return _this;
  }

  _createClass(SelectConfig, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          value = _this$props.value,
          schema = _this$props.schema,
          handleChange = _this$props.handleChange;
      return React.createElement(BlockContainer, {
        id: "select-config"
      }, React.createElement(SectionTitle, {
        title: "\u9009\u62E9\u6846",
        titleTail: "Select"
      }), React.createElement(ConfigItem, {
        title: intl.get("cpaas.cpaasTheme.page.basicSelect").d("基础下拉选择框"),
        simple: true,
        items: this.memoizedBaseSelect(schema),
        defaultSelected: value.select,
        onChange: handleChange("select")
      }), React.createElement(ConfigItem, {
        title: intl.get("cpaas.cpaasTheme.page.labelSelect").d("标签选择框"),
        items: this.memoizedLabelSelect(schema),
        defaultSelected: value.select,
        onChange: handleChange("select")
      }), React.createElement(ConfigItem, {
        title: intl.get("cpaas.cpaasTheme.page.iconSelect").d("图标选择"),
        items: this.memoizedIconSelect(schema),
        defaultSelected: value.select,
        onChange: handleChange("select")
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: intl.get("cpaas.cpaasTheme.page.dateSelect").d("日期选择"),
        items: this.memoizedDateSelect(schema),
        defaultSelected: value.select,
        onChange: handleChange("select")
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: intl.get("cpaas.cpaasTheme.page.rangeDateSelect").d("范围日期选择"),
        items: this.memoizedRangeSelect(schema),
        defaultSelected: value.select,
        onChange: handleChange("select")
      }), React.createElement(ConfigItem, {
        cols: 2,
        title: intl.get("cpaas.cpaasTheme.page.dateAndTimeSelect").d("日期+时间选择"),
        items: this.memoizedDateTimeSelect(schema),
        defaultSelected: value.select,
        onChange: handleChange("select")
      }), React.createElement(ConfigItem, {
        title: React.createElement(MotionTitle, {
          text: intl.get("cpaas.cpaasTheme.page.animation").d("动效")
        }),
        defaultSelected: value.dropdownMotion,
        items: this.getMotions(schema),
        onChange: handleChange("dropdownMotion")
      }));
    }
  }]);

  return SelectConfig;
}(Component), _temp)) || _class;

export { SelectConfig as default };
